﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine;

// Token: 0x0200005C RID: 92
public static class MMD4MecanimCommon
{
	// Token: 0x0600024F RID: 591 RVA: 0x00014180 File Offset: 0x00012380
	public static Color MMDLit_GetTempAmbientL(Color ambient)
	{
		Color a = MMD4MecanimCommon.MMDLit_centerAmbient - ambient;
		a.r = Mathf.Max(a.r, 0f);
		a.g = Mathf.Max(a.g, 0f);
		a.b = Mathf.Max(a.b, 0f);
		a.a = 0f;
		return a * MMD4MecanimCommon.MMDLit_centerAmbientInv.r;
	}

	// Token: 0x06000250 RID: 592 RVA: 0x00014200 File Offset: 0x00012400
	public static Color MMDLit_GetTempAmbient(Color globalAmbient, Color ambient)
	{
		Color result = globalAmbient * (Color.white - MMD4MecanimCommon.MMDLit_GetTempAmbientL(ambient));
		result.a = 0f;
		return result;
	}

	// Token: 0x06000251 RID: 593 RVA: 0x00014234 File Offset: 0x00012434
	public static Color MMDLit_GetTempDiffuse(Color globalAmbient, Color ambient, Color diffuse)
	{
		Color color = ambient + diffuse * MMD4MecanimCommon.MMDLit_globalLighting.r;
		color.r = Mathf.Min(color.r, 1f);
		color.g = Mathf.Min(color.g, 1f);
		color.b = Mathf.Min(color.b, 1f);
		color -= MMD4MecanimCommon.MMDLit_GetTempAmbient(globalAmbient, ambient);
		color.r = Mathf.Max(color.r, 0f);
		color.g = Mathf.Max(color.g, 0f);
		color.b = Mathf.Max(color.b, 0f);
		color.a = 0f;
		return color;
	}

	// Token: 0x06000252 RID: 594 RVA: 0x00014306 File Offset: 0x00012506
	public static void WeakSetMaterialFloat(Material m, string name, float v)
	{
		if (m.GetFloat(name) != v)
		{
			m.SetFloat(name, v);
		}
	}

	// Token: 0x06000253 RID: 595 RVA: 0x0001431D File Offset: 0x0001251D
	public static void WeakSetMaterialVector(Material m, string name, Vector4 v)
	{
		if (m.GetVector(name) != v)
		{
			m.SetVector(name, v);
		}
	}

	// Token: 0x06000254 RID: 596 RVA: 0x00014339 File Offset: 0x00012539
	public static void WeakSetMaterialColor(Material m, string name, Color v)
	{
		if (m.GetColor(name) != v)
		{
			m.SetColor(name, v);
		}
	}

	// Token: 0x06000255 RID: 597 RVA: 0x00014358 File Offset: 0x00012558
	public static Transform WeakAddChildTransform(Transform parentTransform, string name)
	{
		GameObject gameObject = MMD4MecanimCommon.WeakAddChildGameObject((!(parentTransform != null)) ? null : parentTransform.gameObject, name);
		return (!(gameObject != null)) ? null : gameObject.transform;
	}

	// Token: 0x06000256 RID: 598 RVA: 0x0001439C File Offset: 0x0001259C
	public static GameObject WeakAddChildGameObject(GameObject parentGameObject, string name)
	{
		if (parentGameObject != null && !string.IsNullOrEmpty(name))
		{
			IEnumerator enumerator = parentGameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.name == name)
					{
						return transform.gameObject;
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
		}
		GameObject gameObject = new GameObject((name == null) ? string.Empty : name);
		if (parentGameObject != null)
		{
			gameObject.transform.parent = parentGameObject.transform;
		}
		gameObject.layer = parentGameObject.layer;
		gameObject.transform.localPosition = Vector3.zero;
		gameObject.transform.localRotation = Quaternion.identity;
		gameObject.transform.localScale = Vector3.one;
		return gameObject;
	}

	// Token: 0x06000257 RID: 599 RVA: 0x000144A8 File Offset: 0x000126A8
	public static MMD4MecanimCommon.Version GetUnityVersion()
	{
		MMD4MecanimCommon.Version result = default(MMD4MecanimCommon.Version);
		string unityVersion = Application.unityVersion;
		int num = unityVersion.IndexOf(".");
		int num2 = (num < 0) ? -1 : unityVersion.IndexOf(".", num + 1);
		if (num2 >= 0)
		{
			result.major = MMD4MecanimCommon.ToInt(unityVersion, 0, num);
			result.minor = MMD4MecanimCommon.ToInt(unityVersion, num + 1, num2 - (num + 1));
			result.revision = MMD4MecanimCommon.ToInt(unityVersion, num2 + 1, unityVersion.Length - (num2 + 1));
		}
		else if (num >= 0)
		{
			result.major = MMD4MecanimCommon.ToInt(unityVersion, 0, num);
			result.minor = MMD4MecanimCommon.ToInt(unityVersion, num + 1, unityVersion.Length - (num + 1));
		}
		else
		{
			result.major = MMD4MecanimCommon.ToInt(unityVersion);
		}
		return result;
	}

	// Token: 0x06000258 RID: 600 RVA: 0x00014578 File Offset: 0x00012778
	public static GameObject[] GetChildrenRecursivery(GameObject gameObject)
	{
		List<GameObject> list = new List<GameObject>();
		if (gameObject != null)
		{
			MMD4MecanimCommon._GetChildrenRecursivery(list, gameObject);
		}
		return list.ToArray();
	}

	// Token: 0x06000259 RID: 601 RVA: 0x000145A4 File Offset: 0x000127A4
	private static void _GetChildrenRecursivery(List<GameObject> children, GameObject gameObject)
	{
		IEnumerator enumerator = gameObject.transform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform transform = (Transform)obj;
				children.Add(transform.gameObject);
				MMD4MecanimCommon._GetChildrenRecursivery(children, transform.gameObject);
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
	}

	// Token: 0x0600025A RID: 602 RVA: 0x0001461C File Offset: 0x0001281C
	public static void IgnoreCollisionRecursivery(GameObject gameObject, Collider targetCollider)
	{
		if (gameObject != null && targetCollider != null)
		{
			if (gameObject != targetCollider.gameObject)
			{
				Collider component = gameObject.GetComponent<Collider>();
				if (component != null && component.enabled && targetCollider.enabled)
				{
					Physics.IgnoreCollision(component, targetCollider);
				}
			}
			IEnumerator enumerator = gameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					MMD4MecanimCommon.IgnoreCollisionRecursivery(transform.gameObject, targetCollider);
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
		}
	}

	// Token: 0x0600025B RID: 603 RVA: 0x000146E0 File Offset: 0x000128E0
	public static void IgnoreCollisionRecursivery(Collider collider, Collider targetCollider)
	{
		if (collider != null && targetCollider != null)
		{
			MMD4MecanimCommon.IgnoreCollisionRecursivery(collider.gameObject, targetCollider);
		}
	}

	// Token: 0x0600025C RID: 604 RVA: 0x00014708 File Offset: 0x00012908
	public static bool ContainsNameInParents(GameObject gameObject, string name)
	{
		if (gameObject == null)
		{
			return false;
		}
		while (!gameObject.name.Contains(name))
		{
			if (gameObject.transform.parent == null)
			{
				return false;
			}
			gameObject = gameObject.transform.parent.gameObject;
		}
		return true;
	}

	// Token: 0x0600025D RID: 605 RVA: 0x0001476E File Offset: 0x0001296E
	public static int MurmurHash32(string name)
	{
		return MMD4MecanimCommon.MurmurHash32(name, 2880293630U);
	}

	// Token: 0x0600025E RID: 606 RVA: 0x0001477C File Offset: 0x0001297C
	public static int MurmurHash32(string name, uint seed)
	{
		byte[] bytes = Encoding.UTF8.GetBytes(name);
		return MMD4MecanimCommon.MurmurHash32(bytes, 0, bytes.Length, seed);
	}

	// Token: 0x0600025F RID: 607 RVA: 0x000147A0 File Offset: 0x000129A0
	public static int MurmurHash32(byte[] bytes, int pos, int len)
	{
		return MMD4MecanimCommon.MurmurHash32(bytes, pos, len, 2880293630U);
	}

	// Token: 0x06000260 RID: 608 RVA: 0x000147AF File Offset: 0x000129AF
	private static uint mmh3_fmix32(uint h)
	{
		h ^= h >> 16;
		h *= 2246822507U;
		h ^= h >> 13;
		h *= 3266489909U;
		h ^= h >> 16;
		return h;
	}

	// Token: 0x06000261 RID: 609 RVA: 0x000147DC File Offset: 0x000129DC
	public static int MurmurHash32(byte[] bytes, int pos, int len, uint seed)
	{
		int num = len / 4;
		uint num2 = seed;
		uint num3 = 3432918353U;
		uint num4 = 461845907U;
		int i = 0;
		int num5 = num * 4;
		while (i < num5)
		{
			uint num6 = (uint)((int)bytes[pos + i] | (int)bytes[pos + i + 1] << 8 | (int)bytes[pos + i + 2] << 16 | (int)bytes[pos + i + 3] << 24);
			num6 *= num3;
			num6 = (num6 << 15 | num6 >> 17);
			num6 *= num4;
			num2 ^= num6;
			num2 = (num2 << 13 | num2 >> 19);
			num2 = num2 * 5U + 3864292196U;
			i += 4;
		}
		if ((len & 3) != 0)
		{
			uint num7 = 0U;
			if ((len & 3) >= 3)
			{
				num7 ^= (uint)((uint)bytes[pos + num * 4 + 2] << 16);
			}
			if ((len & 3) >= 2)
			{
				num7 ^= (uint)((uint)bytes[pos + num * 4 + 1] << 8);
			}
			if ((len & 3) >= 1)
			{
				num7 ^= (uint)bytes[pos + num * 4];
			}
			num7 *= num3;
			num7 = (num7 << 15 | num7 >> 17);
			num7 *= num4;
			num2 ^= num7;
		}
		num2 ^= (uint)len;
		return (int)MMD4MecanimCommon.mmh3_fmix32(num2);
	}

	// Token: 0x06000262 RID: 610 RVA: 0x000148F1 File Offset: 0x00012AF1
	public static MMD4MecanimCommon.GCHValue<T> MakeGCHValue<T>(ref T value)
	{
		return new MMD4MecanimCommon.GCHValue<T>(ref value);
	}

	// Token: 0x06000263 RID: 611 RVA: 0x000148F9 File Offset: 0x00012AF9
	public static MMD4MecanimCommon.GCHValues<T> MakeGCHValues<T>(T[] values)
	{
		return new MMD4MecanimCommon.GCHValues<T>(values);
	}

	// Token: 0x06000264 RID: 612 RVA: 0x00014901 File Offset: 0x00012B01
	public static int ReadInt(byte[] bytes, int index)
	{
		if (bytes != null && index * 4 + 3 < bytes.Length)
		{
			return (int)bytes[index * 4] | (int)bytes[index * 4 + 1] << 8 | (int)bytes[index * 4 + 2] << 16 | (int)bytes[index * 4 + 3] << 24;
		}
		return 0;
	}

	// Token: 0x06000265 RID: 613 RVA: 0x0001493D File Offset: 0x00012B3D
	private static uint _Swap(uint v)
	{
		return v >> 24 | (v >> 8 & 65280U) | (v << 8 & 16711680U) | v << 24;
	}

	// Token: 0x06000266 RID: 614 RVA: 0x0001495C File Offset: 0x00012B5C
	private static uint _MakeFourCC(char a, char b, char c, char d)
	{
		return (uint)((int)((byte)a) | (int)((byte)b) << 8 | (int)((byte)c) << 16 | (int)((byte)d) << 24);
	}

	// Token: 0x06000267 RID: 615 RVA: 0x00014974 File Offset: 0x00012B74
	public static MMD4MecanimCommon.TextureFileSign GetTextureFileSign(string path)
	{
		MMD4MecanimCommon.TextureFileSign result;
		try
		{
			using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
			{
				byte[] array = new byte[(int)fileStream.Length];
				fileStream.Read(array, 0, (int)fileStream.Length);
				if ((int)fileStream.Length >= 8)
				{
					bool flag = true;
					byte[] array2 = new byte[]
					{
						137,
						80,
						78,
						71,
						13,
						10,
						26,
						10
					};
					for (int i = 0; i < 8; i++)
					{
						if (array[i] != array2[i])
						{
							flag = false;
							break;
						}
					}
					if (flag)
					{
						fileStream.Seek(0L, SeekOrigin.Begin);
						using (System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fileStream))
						{
							binaryReader.ReadInt32();
							binaryReader.ReadInt32();
							for (;;)
							{
								try
								{
									uint num = MMD4MecanimCommon._Swap(binaryReader.ReadUInt32());
									uint num2 = binaryReader.ReadUInt32();
									if (num2 == MMD4MecanimCommon._MakeFourCC('I', 'H', 'D', 'R'))
									{
										if (num < 13U)
										{
											return MMD4MecanimCommon.TextureFileSign.Png;
										}
										binaryReader.ReadUInt32();
										binaryReader.ReadUInt32();
										binaryReader.ReadByte();
										byte b = binaryReader.ReadByte();
										if (b == 4 || b == 6)
										{
											return MMD4MecanimCommon.TextureFileSign.PngWithAlpha;
										}
										num -= 10U;
									}
									else
									{
										if (num2 == MMD4MecanimCommon._MakeFourCC('t', 'R', 'N', 'S'))
										{
											return MMD4MecanimCommon.TextureFileSign.PngWithAlpha;
										}
										if (num2 == MMD4MecanimCommon._MakeFourCC('I', 'E', 'N', 'D'))
										{
											return MMD4MecanimCommon.TextureFileSign.Png;
										}
										if (num2 == MMD4MecanimCommon._MakeFourCC('I', 'D', 'A', 'T'))
										{
											return MMD4MecanimCommon.TextureFileSign.Png;
										}
									}
									for (uint num3 = 0U; num3 < num / 4U; num3 += 1U)
									{
										binaryReader.ReadUInt32();
									}
									for (uint num4 = 0U; num4 < num % 4U; num4 += 1U)
									{
										binaryReader.ReadByte();
									}
									binaryReader.ReadUInt32();
								}
								catch (Exception)
								{
									return MMD4MecanimCommon.TextureFileSign.PngWithAlpha;
								}
							}
						}
					}
				}
				if ((int)fileStream.Length >= 18 && array[0] == 66 && array[1] == 77)
				{
					uint num5 = (uint)((int)array[14] | (int)array[15] << 8 | (int)array[16] << 16 | (int)array[17] << 24);
					if (num5 == 12U)
					{
						return MMD4MecanimCommon.TextureFileSign.Bmp;
					}
					if (num5 == 40U || num5 == 52U || num5 == 56U || num5 == 60U || num5 == 96U || num5 == 108U || num5 == 112U || num5 == 120U || num5 == 124U)
					{
						if (num5 >= 56U)
						{
							uint num6 = (uint)((int)array[66] | (int)array[67] << 8 | (int)array[68] << 16 | (int)array[69] << 9);
							if (num6 != 0U)
							{
								return MMD4MecanimCommon.TextureFileSign.BmpWithAlpha;
							}
						}
						switch ((int)array[30] | (int)array[31] << 8 | (int)array[32] << 16 | (int)array[33] << 9)
						{
						case 0:
						case 1:
						case 2:
						case 3:
						case 4:
							return MMD4MecanimCommon.TextureFileSign.Bmp;
						case 5:
							return MMD4MecanimCommon.TextureFileSign.BmpWithAlpha;
						}
					}
				}
				if ((int)fileStream.Length >= 2 && array[0] == 255 && array[1] == 216)
				{
					return MMD4MecanimCommon.TextureFileSign.Jpeg;
				}
				if ((int)fileStream.Length >= 18)
				{
					byte b2 = array[1];
					byte b3 = array[17];
					byte b4 = (byte)((b3 & 48) >> 4);
					if ((b2 == 0 || b2 == 1) && (b4 == 0 || b4 == 2))
					{
						byte b5 = array[2];
						byte b6 = array[16];
						byte b7 = b3 & 15;
						if ((b5 == 1 || b5 == 9) && (b6 == 1 || b6 == 2 || b6 == 4 || b6 == 8))
						{
							return (b7 <= 0) ? MMD4MecanimCommon.TextureFileSign.Targa : MMD4MecanimCommon.TextureFileSign.TargaWithAlpha;
						}
						if ((b5 == 3 || b5 == 11) && (b6 == 1 || b6 == 2 || b6 == 4 || b6 == 8))
						{
							return (b7 <= 0) ? MMD4MecanimCommon.TextureFileSign.Targa : MMD4MecanimCommon.TextureFileSign.TargaWithAlpha;
						}
						if ((b5 == 2 || b5 == 10) && (b6 == 16 || b6 == 24 || b6 == 32))
						{
							if (b6 == 24)
							{
								return MMD4MecanimCommon.TextureFileSign.Targa;
							}
							if (b6 == 32)
							{
								return MMD4MecanimCommon.TextureFileSign.TargaWithAlpha;
							}
							return (b7 <= 0) ? MMD4MecanimCommon.TextureFileSign.Targa : MMD4MecanimCommon.TextureFileSign.TargaWithAlpha;
						}
					}
				}
			}
			result = MMD4MecanimCommon.TextureFileSign.None;
		}
		catch (Exception)
		{
			result = MMD4MecanimCommon.TextureFileSign.None;
		}
		return result;
	}

	// Token: 0x06000268 RID: 616 RVA: 0x00014E88 File Offset: 0x00013088
	public static bool IsID(string str)
	{
		if (string.IsNullOrEmpty(str))
		{
			return false;
		}
		if (str[0] - '0' > '\t')
		{
			return false;
		}
		for (int num = 1; num != str.Length; num++)
		{
			if (str[num] == '.')
			{
				return true;
			}
			if (str[0] - '0' > '\t')
			{
				return false;
			}
		}
		return false;
	}

	// Token: 0x06000269 RID: 617 RVA: 0x00014EF0 File Offset: 0x000130F0
	public static int ToInt(string str)
	{
		if (str == null)
		{
			return 0;
		}
		return MMD4MecanimCommon.ToInt(str, 0, str.Length);
	}

	// Token: 0x0600026A RID: 618 RVA: 0x00014F08 File Offset: 0x00013108
	public static int ToInt(string str, int pos, int len)
	{
		if (str == null)
		{
			return 0;
		}
		len += pos;
		if (len < str.Length)
		{
			len = str.Length;
		}
		bool flag = false;
		if (pos < len && str[pos] == '-')
		{
			flag = true;
			pos++;
		}
		int num = 0;
		if (pos < len)
		{
			uint num2 = (uint)(str[pos] - '0');
			if (num2 > 9U)
			{
				return 0;
			}
			num = (int)num2;
			pos++;
		}
		while (pos < len)
		{
			uint num3 = (uint)(str[pos] - '0');
			if (num3 > 9U)
			{
				break;
			}
			num = num * 10 + (int)num3;
			pos++;
		}
		return (!flag) ? num : (-num);
	}

	// Token: 0x0600026B RID: 619 RVA: 0x00014FC4 File Offset: 0x000131C4
	public static MMD4MecanimCommon.CloneMeshWork CloneMesh(Mesh sharedMesh)
	{
		if (sharedMesh == null)
		{
			return null;
		}
		MMD4MecanimCommon.CloneMeshWork cloneMeshWork = new MMD4MecanimCommon.CloneMeshWork();
		Mesh mesh = new Mesh();
		cloneMeshWork.mesh = mesh;
		cloneMeshWork.name = sharedMesh.name;
		cloneMeshWork.vertices = sharedMesh.vertices;
		cloneMeshWork.normals = sharedMesh.normals;
		cloneMeshWork.tangents = sharedMesh.tangents;
		cloneMeshWork.colors32 = sharedMesh.colors32;
		cloneMeshWork.boneWeights = sharedMesh.boneWeights;
		cloneMeshWork.bounds = sharedMesh.bounds;
		cloneMeshWork.hideFlags = sharedMesh.hideFlags;
		cloneMeshWork.uv = sharedMesh.uv;
		cloneMeshWork.uv2 = sharedMesh.uv2;
		cloneMeshWork.bindposes = sharedMesh.bindposes;
		cloneMeshWork.triangles = sharedMesh.triangles;
		mesh.name = cloneMeshWork.name;
		mesh.vertices = cloneMeshWork.vertices;
		mesh.normals = cloneMeshWork.normals;
		mesh.tangents = cloneMeshWork.tangents;
		mesh.colors32 = cloneMeshWork.colors32;
		mesh.boneWeights = cloneMeshWork.boneWeights;
		mesh.bounds = cloneMeshWork.bounds;
		mesh.hideFlags = cloneMeshWork.hideFlags;
		mesh.uv = cloneMeshWork.uv;
		mesh.uv2 = cloneMeshWork.uv2;
		mesh.bindposes = cloneMeshWork.bindposes;
		mesh.triangles = cloneMeshWork.triangles;
		if (sharedMesh.subMeshCount > 0)
		{
			mesh.subMeshCount = sharedMesh.subMeshCount;
			for (int i = 0; i < sharedMesh.subMeshCount; i++)
			{
				mesh.SetTriangles(sharedMesh.GetIndices(i), i);
			}
		}
		return cloneMeshWork;
	}

	// Token: 0x0600026C RID: 620 RVA: 0x00015150 File Offset: 0x00013350
	public static Material CloneMaterial(Material sharedMaterial)
	{
		if (sharedMaterial == null)
		{
			return sharedMaterial;
		}
		return new Material(sharedMaterial);
	}

	// Token: 0x0600026D RID: 621 RVA: 0x00015168 File Offset: 0x00013368
	public static bool Approx(ref float src, float dest, float step)
	{
		if (src > dest)
		{
			if ((src -= step) <= dest)
			{
				src = dest;
				return true;
			}
			return false;
		}
		else
		{
			if (src >= dest)
			{
				return true;
			}
			if ((src += step) >= dest)
			{
				src = dest;
				return true;
			}
			return false;
		}
	}

	// Token: 0x0600026E RID: 622 RVA: 0x000151B4 File Offset: 0x000133B4
	public static bool FindAnything<Type>(List<Type> elements, Type element) where Type : class
	{
		if (elements != null)
		{
			for (int i = 0; i < elements.Count; i++)
			{
				if (element == elements[i])
				{
					return true;
				}
			}
		}
		return false;
	}

	// Token: 0x0600026F RID: 623 RVA: 0x000151F8 File Offset: 0x000133F8
	public static bool IsAlphabet(char ch)
	{
		return ch - 'A' <= '\u0019' || ch - 'a' <= '\u0019' || ch - 'Ａ' <= '\u0019' || ch - 'ａ' <= '\u0019';
	}

	// Token: 0x06000270 RID: 624 RVA: 0x00015230 File Offset: 0x00013430
	public static char ToHalfLower(char ch)
	{
		if (ch - 'A' <= '\u0019')
		{
			return ch - 'A' + 'a';
		}
		if (ch - 'Ａ' <= '\u0019')
		{
			return ch - 'Ａ' + 'a';
		}
		if (ch - 'ａ' <= '\u0019')
		{
			return ch - 'ａ' + 'a';
		}
		return ch;
	}

	// Token: 0x06000271 RID: 625 RVA: 0x00015286 File Offset: 0x00013486
	public static float Reciplocal(float x)
	{
		return (x == 0f) ? 0f : (1f / x);
	}

	// Token: 0x06000272 RID: 626 RVA: 0x000152A4 File Offset: 0x000134A4
	public static Vector3 Reciplocal(Vector3 scale)
	{
		return new Vector3(MMD4MecanimCommon.Reciplocal(scale.x), MMD4MecanimCommon.Reciplocal(scale.y), MMD4MecanimCommon.Reciplocal(scale.z));
	}

	// Token: 0x06000273 RID: 627 RVA: 0x000152CF File Offset: 0x000134CF
	public static Vector3 Reciplocal(ref Vector3 scale)
	{
		return new Vector3(MMD4MecanimCommon.Reciplocal(scale.x), MMD4MecanimCommon.Reciplocal(scale.y), MMD4MecanimCommon.Reciplocal(scale.z));
	}

	// Token: 0x06000274 RID: 628 RVA: 0x000152F8 File Offset: 0x000134F8
	public static void ConvertMatrixBulletPhysics(ref Matrix4x4 matrix)
	{
		matrix.m03 = -matrix.m03;
		matrix.m10 = -matrix.m10;
		matrix.m20 = -matrix.m20;
		matrix.m01 = -matrix.m01;
		matrix.m02 = -matrix.m02;
	}

	// Token: 0x06000275 RID: 629 RVA: 0x00015348 File Offset: 0x00013548
	public static Vector3 ComputeMatrixScale(ref Matrix4x4 matrix)
	{
		Vector3 vector = new Vector3(matrix.m00, matrix.m10, matrix.m20);
		float magnitude = vector.magnitude;
		Vector3 vector2 = new Vector3(matrix.m01, matrix.m11, matrix.m21);
		float magnitude2 = vector2.magnitude;
		Vector3 vector3 = new Vector3(matrix.m02, matrix.m12, matrix.m22);
		return new Vector3(magnitude, magnitude2, vector3.magnitude);
	}

	// Token: 0x06000276 RID: 630 RVA: 0x000153BC File Offset: 0x000135BC
	public static Vector3 ComputeMatrixReciplocalScale(ref Matrix4x4 matrix)
	{
		Vector3 vector = new Vector3(matrix.m00, matrix.m10, matrix.m20);
		float x = MMD4MecanimCommon.Reciplocal(vector.magnitude);
		Vector3 vector2 = new Vector3(matrix.m01, matrix.m11, matrix.m21);
		float y = MMD4MecanimCommon.Reciplocal(vector2.magnitude);
		Vector3 vector3 = new Vector3(matrix.m02, matrix.m12, matrix.m22);
		return new Vector3(x, y, MMD4MecanimCommon.Reciplocal(vector3.magnitude));
	}

	// Token: 0x06000277 RID: 631 RVA: 0x00015440 File Offset: 0x00013640
	public static void SetMatrixBasis(ref Matrix4x4 matrix, ref Vector3 right, ref Vector3 up, ref Vector3 forward)
	{
		matrix.m00 = right.x;
		matrix.m10 = right.y;
		matrix.m20 = right.z;
		matrix.m01 = up.x;
		matrix.m11 = up.y;
		matrix.m21 = up.z;
		matrix.m02 = forward.x;
		matrix.m12 = forward.y;
		matrix.m22 = forward.z;
	}

	// Token: 0x06000278 RID: 632 RVA: 0x000154BC File Offset: 0x000136BC
	public static void NormalizeMatrixBasis(ref Matrix4x4 matrix)
	{
		Vector3 a = new Vector3(matrix.m00, matrix.m10, matrix.m20);
		Vector3 a2 = new Vector3(matrix.m01, matrix.m11, matrix.m21);
		Vector3 a3 = new Vector3(matrix.m02, matrix.m12, matrix.m22);
		a *= MMD4MecanimCommon.Reciplocal(a.magnitude);
		a2 *= MMD4MecanimCommon.Reciplocal(a2.magnitude);
		a3 *= MMD4MecanimCommon.Reciplocal(a3.magnitude);
		MMD4MecanimCommon.SetMatrixBasis(ref matrix, ref a, ref a2, ref a3);
	}

	// Token: 0x06000279 RID: 633 RVA: 0x0001555C File Offset: 0x0001375C
	public static void NormalizeMatrixBasis(ref Matrix4x4 matrix, ref Vector3 rScale)
	{
		Vector3 vector = new Vector3(matrix.m00, matrix.m10, matrix.m20) * rScale.x;
		Vector3 vector2 = new Vector3(matrix.m01, matrix.m11, matrix.m21) * rScale.y;
		Vector3 vector3 = new Vector3(matrix.m02, matrix.m12, matrix.m22) * rScale.z;
		MMD4MecanimCommon.SetMatrixBasis(ref matrix, ref vector, ref vector2, ref vector3);
	}

	// Token: 0x0600027A RID: 634 RVA: 0x000155DE File Offset: 0x000137DE
	public static bool IsNoEffects(ref float value, MMD4MecanimData.MorphMaterialOperation operation)
	{
		if (operation != MMD4MecanimData.MorphMaterialOperation.Adding)
		{
			return operation != MMD4MecanimData.MorphMaterialOperation.Multiply || Mathf.Abs(value - 1f) <= Mathf.Epsilon;
		}
		return value <= Mathf.Epsilon;
	}

	// Token: 0x0600027B RID: 635 RVA: 0x00015618 File Offset: 0x00013818
	public static bool IsNoEffects(ref Color color, MMD4MecanimData.MorphMaterialOperation operation)
	{
		if (operation != MMD4MecanimData.MorphMaterialOperation.Adding)
		{
			return operation != MMD4MecanimData.MorphMaterialOperation.Multiply || (Mathf.Abs(color.r - 1f) <= Mathf.Epsilon && Mathf.Abs(color.g - 1f) <= Mathf.Epsilon && Mathf.Abs(color.b - 1f) <= Mathf.Epsilon && Mathf.Abs(color.a - 1f) <= Mathf.Epsilon);
		}
		return color.r <= Mathf.Epsilon && color.g <= Mathf.Epsilon && color.b <= Mathf.Epsilon && color.a <= Mathf.Epsilon;
	}

	// Token: 0x0600027C RID: 636 RVA: 0x000156EC File Offset: 0x000138EC
	public static bool IsNoEffectsRGB(ref Color color, MMD4MecanimData.MorphMaterialOperation operation)
	{
		if (operation != MMD4MecanimData.MorphMaterialOperation.Adding)
		{
			return operation != MMD4MecanimData.MorphMaterialOperation.Multiply || (Mathf.Abs(color.r - 1f) <= Mathf.Epsilon && Mathf.Abs(color.g - 1f) <= Mathf.Epsilon && Mathf.Abs(color.b - 1f) <= Mathf.Epsilon);
		}
		return color.r <= Mathf.Epsilon && color.g <= Mathf.Epsilon && color.b <= Mathf.Epsilon;
	}

	// Token: 0x0600027D RID: 637 RVA: 0x00015798 File Offset: 0x00013998
	public static float NormalizeAsDegree(float v)
	{
		if (v < -180f)
		{
			do
			{
				v += 360f;
			}
			while (v < -180f);
		}
		else if (v > 180f)
		{
			do
			{
				v -= 360f;
			}
			while (v > 180f);
		}
		return v;
	}

	// Token: 0x0600027E RID: 638 RVA: 0x000157E9 File Offset: 0x000139E9
	public static Vector3 NormalizeAsDegree(Vector3 degrees)
	{
		return new Vector3(MMD4MecanimCommon.NormalizeAsDegree(degrees.x), MMD4MecanimCommon.NormalizeAsDegree(degrees.y), MMD4MecanimCommon.NormalizeAsDegree(degrees.z));
	}

	// Token: 0x0600027F RID: 639 RVA: 0x00015814 File Offset: 0x00013A14
	public static bool FuzzyZero(float v)
	{
		return Math.Abs(v) <= Mathf.Epsilon;
	}

	// Token: 0x06000280 RID: 640 RVA: 0x00015828 File Offset: 0x00013A28
	public static bool FuzzyZero(Vector3 v)
	{
		return Mathf.Abs(v.x) <= Mathf.Epsilon && Mathf.Abs(v.y) <= Mathf.Epsilon && Mathf.Abs(v.z) <= Mathf.Epsilon;
	}

	// Token: 0x06000281 RID: 641 RVA: 0x0001587A File Offset: 0x00013A7A
	public static Quaternion Inverse(Quaternion q)
	{
		return new Quaternion(-q.x, -q.y, -q.z, q.w);
	}

	// Token: 0x06000282 RID: 642 RVA: 0x000158A0 File Offset: 0x00013AA0
	public static bool FuzzyIdentity(Quaternion q)
	{
		return Mathf.Abs(q.x) <= Mathf.Epsilon && Mathf.Abs(q.y) <= Mathf.Epsilon && Mathf.Abs(q.z) <= Mathf.Epsilon && Mathf.Abs(q.w - 1f) <= Mathf.Epsilon;
	}

	// Token: 0x06000283 RID: 643 RVA: 0x0001590E File Offset: 0x00013B0E
	public static Quaternion FuzzyMul(Quaternion lhs, Quaternion rhs)
	{
		if (MMD4MecanimCommon.FuzzyIdentity(lhs))
		{
			return rhs;
		}
		if (MMD4MecanimCommon.FuzzyIdentity(rhs))
		{
			return lhs;
		}
		return lhs * rhs;
	}

	// Token: 0x06000284 RID: 644 RVA: 0x00015931 File Offset: 0x00013B31
	public static Quaternion FastMul(Quaternion lhs, Quaternion rhs)
	{
		if (lhs == Quaternion.identity)
		{
			return rhs;
		}
		if (rhs == Quaternion.identity)
		{
			return lhs;
		}
		return lhs * rhs;
	}

	// Token: 0x06000285 RID: 645 RVA: 0x0001595E File Offset: 0x00013B5E
	public static void FuzzyAdd(ref float lhs, ref float rhs)
	{
		if (rhs > Mathf.Epsilon)
		{
			lhs += rhs;
		}
	}

	// Token: 0x06000286 RID: 646 RVA: 0x00015974 File Offset: 0x00013B74
	public static void FuzzyAdd(ref Color lhs, ref Color rhs)
	{
		if (rhs.r > Mathf.Epsilon)
		{
			lhs.r += rhs.r;
		}
		if (rhs.g > Mathf.Epsilon)
		{
			lhs.g += rhs.g;
		}
		if (rhs.b > Mathf.Epsilon)
		{
			lhs.b += rhs.b;
		}
		if (rhs.a > Mathf.Epsilon)
		{
			lhs.a += rhs.a;
		}
	}

	// Token: 0x06000287 RID: 647 RVA: 0x00015A0D File Offset: 0x00013C0D
	public static void FuzzyMul(ref float lhs, ref float rhs)
	{
		if (Mathf.Abs(rhs - 1f) > Mathf.Epsilon)
		{
			lhs *= rhs;
		}
	}

	// Token: 0x06000288 RID: 648 RVA: 0x00015A30 File Offset: 0x00013C30
	public static void FuzzyMul(ref Color lhs, ref Color rhs)
	{
		if (Mathf.Abs(rhs.r - 1f) > Mathf.Epsilon)
		{
			lhs.r *= rhs.r;
		}
		if (Mathf.Abs(rhs.g - 1f) > Mathf.Epsilon)
		{
			lhs.g *= rhs.g;
		}
		if (Mathf.Abs(rhs.b - 1f) > Mathf.Epsilon)
		{
			lhs.b *= rhs.b;
		}
		if (Mathf.Abs(rhs.a - 1f) > Mathf.Epsilon)
		{
			lhs.a *= rhs.a;
		}
	}

	// Token: 0x06000289 RID: 649 RVA: 0x00015AF5 File Offset: 0x00013CF5
	public static void FuzzyAdd(ref float lhs, ref float rhs, float weight)
	{
		if (rhs > Mathf.Epsilon)
		{
			lhs += rhs * weight;
		}
	}

	// Token: 0x0600028A RID: 650 RVA: 0x00015B0C File Offset: 0x00013D0C
	public static void FuzzyAdd(ref Color lhs, ref Color rhs, float weight)
	{
		if (rhs.r > Mathf.Epsilon)
		{
			lhs.r += rhs.r * weight;
		}
		if (rhs.g > Mathf.Epsilon)
		{
			lhs.g += rhs.g * weight;
		}
		if (rhs.b > Mathf.Epsilon)
		{
			lhs.b += rhs.b * weight;
		}
		if (rhs.a > Mathf.Epsilon)
		{
			lhs.a += rhs.a * weight;
		}
	}

	// Token: 0x0600028B RID: 651 RVA: 0x00015BAD File Offset: 0x00013DAD
	public static void FuzzyMul(ref float lhs, ref float rhs, float weight)
	{
		if (Mathf.Abs(rhs - 1f) > Mathf.Epsilon)
		{
			lhs *= rhs * weight + (1f - weight);
		}
	}

	// Token: 0x0600028C RID: 652 RVA: 0x00015BD8 File Offset: 0x00013DD8
	public static void FuzzyMul(ref Color lhs, ref Color rhs, float weight)
	{
		if (Mathf.Abs(rhs.r - 1f) > Mathf.Epsilon)
		{
			lhs.r *= rhs.r * weight + (1f - weight);
		}
		if (Mathf.Abs(rhs.g - 1f) > Mathf.Epsilon)
		{
			lhs.g *= rhs.g * weight + (1f - weight);
		}
		if (Mathf.Abs(rhs.b - 1f) > Mathf.Epsilon)
		{
			lhs.b *= rhs.b * weight + (1f - weight);
		}
		if (Mathf.Abs(rhs.a - 1f) > Mathf.Epsilon)
		{
			lhs.a *= rhs.a * weight + (1f - weight);
		}
	}

	// Token: 0x0600028D RID: 653 RVA: 0x00015CC8 File Offset: 0x00013EC8
	public static void OperationMaterial(ref MMD4MecanimData.MorphMaterialData currentMaterialData, ref MMD4MecanimData.MorphMaterialData operationMaterialData, float weight)
	{
		if (Mathf.Abs(weight - 1f) <= Mathf.Epsilon)
		{
			MMD4MecanimData.MorphMaterialOperation operation = operationMaterialData.operation;
			if (operation != MMD4MecanimData.MorphMaterialOperation.Adding)
			{
				if (operation == MMD4MecanimData.MorphMaterialOperation.Multiply)
				{
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.diffuse, ref operationMaterialData.diffuse);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.specular, ref operationMaterialData.specular);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.shininess, ref operationMaterialData.shininess);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.ambient, ref operationMaterialData.ambient);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.edgeColor, ref operationMaterialData.edgeColor);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.edgeSize, ref operationMaterialData.edgeSize);
				}
			}
			else
			{
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.diffuse, ref operationMaterialData.diffuse);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.specular, ref operationMaterialData.specular);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.shininess, ref operationMaterialData.shininess);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.ambient, ref operationMaterialData.ambient);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.edgeColor, ref operationMaterialData.edgeColor);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.edgeSize, ref operationMaterialData.edgeSize);
			}
		}
		else
		{
			MMD4MecanimData.MorphMaterialOperation operation2 = operationMaterialData.operation;
			if (operation2 != MMD4MecanimData.MorphMaterialOperation.Adding)
			{
				if (operation2 == MMD4MecanimData.MorphMaterialOperation.Multiply)
				{
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.diffuse, ref operationMaterialData.diffuse, weight);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.specular, ref operationMaterialData.specular, weight);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.shininess, ref operationMaterialData.shininess, weight);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.ambient, ref operationMaterialData.ambient, weight);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.edgeColor, ref operationMaterialData.edgeColor, weight);
					MMD4MecanimCommon.FuzzyMul(ref currentMaterialData.edgeSize, ref operationMaterialData.edgeSize, weight);
				}
			}
			else
			{
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.diffuse, ref operationMaterialData.diffuse, weight);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.specular, ref operationMaterialData.specular, weight);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.shininess, ref operationMaterialData.shininess, weight);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.ambient, ref operationMaterialData.ambient, weight);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.edgeColor, ref operationMaterialData.edgeColor, weight);
				MMD4MecanimCommon.FuzzyAdd(ref currentMaterialData.edgeSize, ref operationMaterialData.edgeSize, weight);
			}
		}
	}

	// Token: 0x0600028E RID: 654 RVA: 0x00015EDC File Offset: 0x000140DC
	public static void BackupMaterial(ref MMD4MecanimData.MorphMaterialData materialData, Material material)
	{
		if (material != null && material.shader != null)
		{
			materialData.materialID = MMD4MecanimCommon.ToInt(material.name);
			materialData.diffuse = material.GetColor("_Color");
			if (material.shader.name.StartsWith("MMD4Mecanim"))
			{
				materialData.specular = material.GetColor("_Specular");
				materialData.shininess = material.GetFloat("_Shininess");
				materialData.ambient = material.GetColor("_Ambient");
				materialData.edgeColor = material.GetColor("_EdgeColor");
				materialData.edgeScale = material.GetFloat("_EdgeScale");
				materialData.edgeSize = material.GetFloat("_EdgeSize");
				materialData.alPower = material.GetFloat("_ALPower");
			}
			materialData.specular *= 1f / MMD4MecanimCommon.MMDLit_globalLighting.r;
			if (materialData.edgeScale > 0f)
			{
				materialData.edgeSize *= 1f / materialData.edgeScale;
			}
		}
	}

	// Token: 0x0600028F RID: 655 RVA: 0x00016008 File Offset: 0x00014208
	public static void FeedbackMaterial(ref MMD4MecanimData.MorphMaterialData materialData, Material material, MMD4MecanimModel.MorphAutoLuminous morphAutoLuminous)
	{
		if (material != null && material.shader != null && morphAutoLuminous != null)
		{
			material.SetColor("_Color", materialData.diffuse);
			if (material.shader.name.StartsWith("MMD4Mecanim"))
			{
				material.SetColor("_Specular", materialData.specular * MMD4MecanimCommon.MMDLit_globalLighting.r);
				material.SetFloat("_Shininess", materialData.shininess);
				material.SetColor("_Ambient", materialData.ambient);
				material.SetColor("_EdgeColor", materialData.edgeColor);
				material.SetFloat("_EdgeSize", materialData.edgeSize * materialData.edgeScale);
			}
			if (materialData.shininess > 100f)
			{
				Color value = MMD4MecanimCommon.ComputeAutoLuminousEmissiveColor(materialData.diffuse, materialData.ambient, materialData.shininess, materialData.alPower, morphAutoLuminous);
				material.SetColor("_Emissive", value);
			}
			else
			{
				material.SetColor("_Emissive", new Color(0f, 0f, 0f, 0f));
			}
		}
	}

	// Token: 0x06000290 RID: 656 RVA: 0x00016138 File Offset: 0x00014338
	public static Color ComputeAutoLuminousEmissiveColor(Color diffuse, Color ambient, float shininess, float alPower)
	{
		if (alPower > 0f)
		{
			return (diffuse + ambient * 0.5f) * 0.5f * (shininess - 100f) * alPower * 0.14285715f;
		}
		return new Color(0f, 0f, 0f, 0f);
	}

	// Token: 0x06000291 RID: 657 RVA: 0x000161A4 File Offset: 0x000143A4
	public static Color ComputeAutoLuminousEmissiveColor(Color diffuse, Color ambient, float shininess, float alPower, MMD4MecanimModel.MorphAutoLuminous morphAutoLuminous)
	{
		Color color = MMD4MecanimCommon.ComputeAutoLuminousEmissiveColor(diffuse, ambient, shininess, alPower);
		if (morphAutoLuminous != null)
		{
			return color * (1f + morphAutoLuminous.lightUp * 3f) * (1f - morphAutoLuminous.lightOff);
		}
		return color;
	}

	// Token: 0x06000292 RID: 658 RVA: 0x000161F0 File Offset: 0x000143F0
	private static void _GetMeshRenderers(ArrayList meshRenderers, Transform parentTransform)
	{
		if (parentTransform.GetComponent<Animator>())
		{
			return;
		}
		MeshRenderer component = parentTransform.GetComponent<MeshRenderer>();
		if (component != null)
		{
			meshRenderers.Add(component);
		}
		IEnumerator enumerator = parentTransform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform parentTransform2 = (Transform)obj;
				MMD4MecanimCommon._GetMeshRenderers(meshRenderers, parentTransform2);
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
	}

	// Token: 0x06000293 RID: 659 RVA: 0x0001627C File Offset: 0x0001447C
	public static MeshRenderer[] GetMeshRenderers(GameObject parentGameObject)
	{
		if (parentGameObject != null)
		{
			ArrayList arrayList = new ArrayList();
			IEnumerator enumerator = parentGameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.name == "U_Char" || transform.name.StartsWith("U_Char_"))
					{
						MMD4MecanimCommon._GetMeshRenderers(arrayList, transform);
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
			if (arrayList.Count == 0)
			{
				MeshRenderer component = parentGameObject.GetComponent<MeshRenderer>();
				if (component != null)
				{
					arrayList.Add(component);
				}
			}
			if (arrayList.Count > 0)
			{
				MeshRenderer[] array = new MeshRenderer[arrayList.Count];
				for (int i = 0; i < arrayList.Count; i++)
				{
					array[i] = (MeshRenderer)arrayList[i];
				}
				return array;
			}
		}
		return null;
	}

	// Token: 0x06000294 RID: 660 RVA: 0x00016390 File Offset: 0x00014590
	private static void _GetSkinnedMeshRenderers(ArrayList skinnedMeshRenderers, Transform parentTransform)
	{
		if (parentTransform.GetComponent<Animator>())
		{
			return;
		}
		SkinnedMeshRenderer component = parentTransform.GetComponent<SkinnedMeshRenderer>();
		if (component != null)
		{
			skinnedMeshRenderers.Add(component);
		}
		IEnumerator enumerator = parentTransform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform parentTransform2 = (Transform)obj;
				MMD4MecanimCommon._GetSkinnedMeshRenderers(skinnedMeshRenderers, parentTransform2);
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
	}

	// Token: 0x06000295 RID: 661 RVA: 0x0001641C File Offset: 0x0001461C
	public static SkinnedMeshRenderer[] GetSkinnedMeshRenderers(GameObject parentGameObject)
	{
		if (parentGameObject != null)
		{
			ArrayList arrayList = new ArrayList();
			IEnumerator enumerator = parentGameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.name == "U_Char" || transform.name.StartsWith("U_Char_"))
					{
						MMD4MecanimCommon._GetSkinnedMeshRenderers(arrayList, transform);
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
			if (arrayList.Count > 0)
			{
				SkinnedMeshRenderer[] array = new SkinnedMeshRenderer[arrayList.Count];
				for (int i = 0; i < arrayList.Count; i++)
				{
					array[i] = (SkinnedMeshRenderer)arrayList[i];
				}
				return array;
			}
		}
		return null;
	}

	// Token: 0x06000296 RID: 662 RVA: 0x00016508 File Offset: 0x00014708
	private static MeshRenderer _GetMeshRenderer(Transform parentTransform)
	{
		if (parentTransform.GetComponent<Animator>())
		{
			return null;
		}
		MeshRenderer meshRenderer = parentTransform.GetComponent<MeshRenderer>();
		if (meshRenderer != null)
		{
			return meshRenderer;
		}
		IEnumerator enumerator = parentTransform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform parentTransform2 = (Transform)obj;
				meshRenderer = MMD4MecanimCommon._GetMeshRenderer(parentTransform2);
				if (meshRenderer != null)
				{
					return meshRenderer;
				}
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
		return null;
	}

	// Token: 0x06000297 RID: 663 RVA: 0x000165A8 File Offset: 0x000147A8
	public static MeshRenderer GetMeshRenderer(GameObject parentGameObject)
	{
		if (parentGameObject != null)
		{
			IEnumerator enumerator = parentGameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.name == "U_Char" || transform.name.StartsWith("U_Char_"))
					{
						MeshRenderer meshRenderer = MMD4MecanimCommon._GetMeshRenderer(transform);
						if (meshRenderer != null)
						{
							return meshRenderer;
						}
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
			MeshRenderer component = parentGameObject.GetComponent<MeshRenderer>();
			if (component != null)
			{
				return component;
			}
		}
		return null;
	}

	// Token: 0x06000298 RID: 664 RVA: 0x00016674 File Offset: 0x00014874
	private static SkinnedMeshRenderer _GetSkinnedMeshRenderer(Transform parentTransform)
	{
		if (parentTransform.GetComponent<Animator>())
		{
			return null;
		}
		SkinnedMeshRenderer skinnedMeshRenderer = parentTransform.GetComponent<SkinnedMeshRenderer>();
		if (skinnedMeshRenderer != null)
		{
			return skinnedMeshRenderer;
		}
		IEnumerator enumerator = parentTransform.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				object obj = enumerator.Current;
				Transform parentTransform2 = (Transform)obj;
				skinnedMeshRenderer = MMD4MecanimCommon._GetSkinnedMeshRenderer(parentTransform2);
				if (skinnedMeshRenderer != null)
				{
					return skinnedMeshRenderer;
				}
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
		return null;
	}

	// Token: 0x06000299 RID: 665 RVA: 0x00016714 File Offset: 0x00014914
	public static SkinnedMeshRenderer GetSkinnedMeshRenderer(GameObject parentGameObject)
	{
		if (parentGameObject != null)
		{
			IEnumerator enumerator = parentGameObject.transform.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					object obj = enumerator.Current;
					Transform transform = (Transform)obj;
					if (transform.name == "U_Char" || transform.name.StartsWith("U_Char_"))
					{
						SkinnedMeshRenderer skinnedMeshRenderer = MMD4MecanimCommon._GetSkinnedMeshRenderer(transform);
						if (skinnedMeshRenderer != null)
						{
							return skinnedMeshRenderer;
						}
					}
				}
			}
			finally
			{
				IDisposable disposable;
				if ((disposable = (enumerator as IDisposable)) != null)
				{
					disposable.Dispose();
				}
			}
		}
		return null;
	}

	// Token: 0x0600029A RID: 666 RVA: 0x000167C8 File Offset: 0x000149C8
	public static GameObject[] FindRootObjects()
	{
		return Array.FindAll<GameObject>(UnityEngine.Object.FindObjectsOfType<GameObject>(), (GameObject item) => item.transform.parent == null);
	}

	// Token: 0x0600029B RID: 667 RVA: 0x000167F4 File Offset: 0x000149F4
	public static bool IsExtensionAnimBytes(string name)
	{
		if (name != null)
		{
			int length = name.Length;
			int length2 = MMD4MecanimCommon.ExtensionAnimBytesLower.Length;
			if (length >= length2)
			{
				for (int i = 0; i < length2; i++)
				{
					if (name[length - length2 + i] != MMD4MecanimCommon.ExtensionAnimBytesLower[i] && name[length - length2 + i] != MMD4MecanimCommon.ExtensionAnimBytesUpper[i])
					{
						return false;
					}
				}
				return true;
			}
		}
		return false;
	}

	// Token: 0x0600029C RID: 668 RVA: 0x00016874 File Offset: 0x00014A74
	public static bool IsDebugShader(Material material)
	{
		return material != null && material.shader != null && material.shader.name != null && material.shader.name.StartsWith("MMD4Mecanim") && material.shader.name.Contains("Test");
	}

	// Token: 0x0600029D RID: 669 RVA: 0x000168E8 File Offset: 0x00014AE8
	public static bool IsDeferredShader(Material material)
	{
		return material != null && material.shader != null && material.shader.name != null && material.shader.name.StartsWith("MMD4Mecanim") && material.shader.name.Contains("Deferred");
	}

	// Token: 0x0600029E RID: 670 RVA: 0x00016959 File Offset: 0x00014B59
	public static int SizeOf<T>()
	{
		return Marshal.SizeOf(typeof(T));
	}

	// Token: 0x0600029F RID: 671 RVA: 0x0001696C File Offset: 0x00014B6C
	public static Type WeakAddComponent<Type>(GameObject go) where Type : Behaviour
	{
		if (!(go != null))
		{
			return (Type)((object)null);
		}
		Type component = go.GetComponent<Type>();
		if (component != null)
		{
			return component;
		}
		return go.AddComponent<Type>();
	}

	// Token: 0x04000306 RID: 774
	public static readonly Color MMDLit_centerAmbient = new Color(0.5f, 0.5f, 0.5f);

	// Token: 0x04000307 RID: 775
	public static readonly Color MMDLit_centerAmbientInv = new Color(2f, 2f, 2f);

	// Token: 0x04000308 RID: 776
	public static readonly Color MMDLit_globalLighting = new Color(0.6f, 0.6f, 0.6f);

	// Token: 0x04000309 RID: 777
	public static readonly float MMDLit_edgeScale = 0.001f;

	// Token: 0x0400030A RID: 778
	public static readonly string ExtensionAnimBytesLower = ".anim.bytes";

	// Token: 0x0400030B RID: 779
	public static readonly string ExtensionAnimBytesUpper = ".ANIM.BYTES";

	// Token: 0x0200005D RID: 93
	public struct Version
	{
		// Token: 0x060002A2 RID: 674 RVA: 0x00016A35 File Offset: 0x00014C35
		public bool LaterThan(int major)
		{
			return this.major >= major;
		}

		// Token: 0x060002A3 RID: 675 RVA: 0x00016A43 File Offset: 0x00014C43
		public bool LaterThan(int major, int minor)
		{
			return this.major >= major && (this.major > major || this.minor >= minor);
		}

		// Token: 0x060002A4 RID: 676 RVA: 0x00016A70 File Offset: 0x00014C70
		public bool LaterThan(int major, int minor, int revision)
		{
			return this.major >= major && (this.major > major || (this.minor >= minor && (this.minor > minor || this.revision >= revision)));
		}

		// Token: 0x0400030D RID: 781
		public int major;

		// Token: 0x0400030E RID: 782
		public int minor;

		// Token: 0x0400030F RID: 783
		public int revision;
	}

	// Token: 0x0200005E RID: 94
	public struct GCHValue<T>
	{
		// Token: 0x060002A5 RID: 677 RVA: 0x00016AC1 File Offset: 0x00014CC1
		public GCHValue(ref T value)
		{
			this._gch_value = GCHandle.Alloc(value, GCHandleType.Pinned);
			this._valuePtr = this._gch_value.AddrOfPinnedObject();
		}

		// Token: 0x060002A6 RID: 678 RVA: 0x00016AEB File Offset: 0x00014CEB
		public static implicit operator IntPtr(MMD4MecanimCommon.GCHValue<T> v)
		{
			return v._valuePtr;
		}

		// Token: 0x060002A7 RID: 679 RVA: 0x00016AF4 File Offset: 0x00014CF4
		public void Free()
		{
			if (this._valuePtr != IntPtr.Zero)
			{
				this._valuePtr = IntPtr.Zero;
				this._gch_value.Free();
			}
		}

		// Token: 0x04000310 RID: 784
		private GCHandle _gch_value;

		// Token: 0x04000311 RID: 785
		private IntPtr _valuePtr;
	}

	// Token: 0x0200005F RID: 95
	public struct GCHValues<T>
	{
		// Token: 0x060002A8 RID: 680 RVA: 0x00016B24 File Offset: 0x00014D24
		public GCHValues(T[] values)
		{
			if (values != null)
			{
				this._gch_values = GCHandle.Alloc(values, GCHandleType.Pinned);
				this._valuesPtr = this._gch_values.AddrOfPinnedObject();
				this.length = values.Length;
			}
			else
			{
				this._gch_values = default(GCHandle);
				this._valuesPtr = IntPtr.Zero;
				this.length = 0;
			}
		}

		// Token: 0x060002A9 RID: 681 RVA: 0x00016B84 File Offset: 0x00014D84
		public static implicit operator IntPtr(MMD4MecanimCommon.GCHValues<T> v)
		{
			return v._valuesPtr;
		}

		// Token: 0x060002AA RID: 682 RVA: 0x00016B8D File Offset: 0x00014D8D
		public void Free()
		{
			if (this._valuesPtr != IntPtr.Zero)
			{
				this._valuesPtr = IntPtr.Zero;
				this._gch_values.Free();
			}
		}

		// Token: 0x04000312 RID: 786
		private GCHandle _gch_values;

		// Token: 0x04000313 RID: 787
		private IntPtr _valuesPtr;

		// Token: 0x04000314 RID: 788
		public int length;
	}

	// Token: 0x02000060 RID: 96
	public class PropertyWriter
	{
		// Token: 0x060002AC RID: 684 RVA: 0x00016BD8 File Offset: 0x00014DD8
		public void Clear()
		{
			this._iValues.Clear();
			this._fValues.Clear();
		}

		// Token: 0x060002AD RID: 685 RVA: 0x00016BF0 File Offset: 0x00014DF0
		public void Write(string propertyName, bool value)
		{
			this._iValues.Add(MMD4MecanimCommon.MurmurHash32(propertyName));
			this._iValues.Add((!value) ? 0 : 1);
		}

		// Token: 0x060002AE RID: 686 RVA: 0x00016C1B File Offset: 0x00014E1B
		public void Write(string propertyName, int value)
		{
			this._iValues.Add(MMD4MecanimCommon.MurmurHash32(propertyName));
			this._iValues.Add(value);
		}

		// Token: 0x060002AF RID: 687 RVA: 0x00016C3A File Offset: 0x00014E3A
		public void Write(string propertyName, float value)
		{
			this._iValues.Add(MMD4MecanimCommon.MurmurHash32(propertyName));
			this._fValues.Add(value);
		}

		// Token: 0x060002B0 RID: 688 RVA: 0x00016C5C File Offset: 0x00014E5C
		public void Write(string propertyName, Vector3 value)
		{
			this._iValues.Add(MMD4MecanimCommon.MurmurHash32(propertyName));
			this._fValues.Add(value.x);
			this._fValues.Add(value.y);
			this._fValues.Add(value.z);
		}

		// Token: 0x060002B1 RID: 689 RVA: 0x00016CB0 File Offset: 0x00014EB0
		public void Write(string propertyName, Quaternion value)
		{
			this._iValues.Add(MMD4MecanimCommon.MurmurHash32(propertyName));
			this._fValues.Add(value.x);
			this._fValues.Add(value.y);
			this._fValues.Add(value.z);
			this._fValues.Add(value.w);
		}

		// Token: 0x1700005B RID: 91
		// (get) Token: 0x060002B2 RID: 690 RVA: 0x00016D16 File Offset: 0x00014F16
		public int iValueLength
		{
			get
			{
				return (this._lock_iValues == null) ? 0 : this._lock_iValues.Length;
			}
		}

		// Token: 0x1700005C RID: 92
		// (get) Token: 0x060002B3 RID: 691 RVA: 0x00016D31 File Offset: 0x00014F31
		public int fValueLength
		{
			get
			{
				return (this._lock_fValues == null) ? 0 : this._lock_fValues.Length;
			}
		}

		// Token: 0x060002B4 RID: 692 RVA: 0x00016D4C File Offset: 0x00014F4C
		public void Lock()
		{
			this._lock_iValues = this._iValues.ToArray();
			this._lock_fValues = this._fValues.ToArray();
			this._gch_iValues = GCHandle.Alloc(this._lock_iValues, GCHandleType.Pinned);
			this._gch_fValues = GCHandle.Alloc(this._lock_fValues, GCHandleType.Pinned);
			this.iValuesPtr = this._gch_iValues.AddrOfPinnedObject();
			this.fValuesPtr = this._gch_fValues.AddrOfPinnedObject();
		}

		// Token: 0x060002B5 RID: 693 RVA: 0x00016DC1 File Offset: 0x00014FC1
		public void Unlock()
		{
			this._gch_fValues.Free();
			this._gch_iValues.Free();
			this.fValuesPtr = IntPtr.Zero;
			this.iValuesPtr = IntPtr.Zero;
		}

		// Token: 0x04000315 RID: 789
		private List<int> _iValues = new List<int>();

		// Token: 0x04000316 RID: 790
		private List<float> _fValues = new List<float>();

		// Token: 0x04000317 RID: 791
		private int[] _lock_iValues;

		// Token: 0x04000318 RID: 792
		private float[] _lock_fValues;

		// Token: 0x04000319 RID: 793
		private GCHandle _gch_iValues;

		// Token: 0x0400031A RID: 794
		private GCHandle _gch_fValues;

		// Token: 0x0400031B RID: 795
		public IntPtr iValuesPtr;

		// Token: 0x0400031C RID: 796
		public IntPtr fValuesPtr;
	}

	// Token: 0x02000061 RID: 97
	public class BinaryReader
	{
		// Token: 0x060002B6 RID: 694 RVA: 0x00016DEF File Offset: 0x00014FEF
		public BinaryReader(byte[] fileBytes)
		{
			this._fileBytes = fileBytes;
		}

		// Token: 0x1700005D RID: 93
		// (get) Token: 0x060002B7 RID: 695 RVA: 0x00016DFE File Offset: 0x00014FFE
		public int structListLength
		{
			get
			{
				return (this._header == null) ? 0 : this._header[6];
			}
		}

		// Token: 0x1700005E RID: 94
		// (get) Token: 0x060002B8 RID: 696 RVA: 0x00016E19 File Offset: 0x00015019
		public int currentStructFourCC
		{
			get
			{
				return this._currentStructFourCC;
			}
		}

		// Token: 0x1700005F RID: 95
		// (get) Token: 0x060002B9 RID: 697 RVA: 0x00016E21 File Offset: 0x00015021
		public int currentStructFlags
		{
			get
			{
				return this._currentStructFlags;
			}
		}

		// Token: 0x17000060 RID: 96
		// (get) Token: 0x060002BA RID: 698 RVA: 0x00016E29 File Offset: 0x00015029
		public int currentStructLength
		{
			get
			{
				return this._currentStructLength;
			}
		}

		// Token: 0x17000061 RID: 97
		// (get) Token: 0x060002BB RID: 699 RVA: 0x00016E31 File Offset: 0x00015031
		public int currentStructIndex
		{
			get
			{
				return this._currentStructIndex;
			}
		}

		// Token: 0x060002BC RID: 700 RVA: 0x00016E39 File Offset: 0x00015039
		public static int MakeFourCC(string str)
		{
			return (int)(str[0] | (int)str[1] << 8 | (int)str[2] << 16 | (int)str[3] << 24);
		}

		// Token: 0x060002BD RID: 701 RVA: 0x00016E62 File Offset: 0x00015062
		public int GetFourCC()
		{
			return this._fourCC;
		}

		// Token: 0x060002BE RID: 702 RVA: 0x00016E6C File Offset: 0x0001506C
		public bool Preparse()
		{
			if (this._fileBytes == null || this._fileBytes.Length == 0)
			{
				Debug.LogError("(BinaryReader) fileBytes is Nothing.");
				this._isError = true;
				return false;
			}
			int num = 0;
			this._fourCC = MMD4MecanimCommon.ReadInt(this._fileBytes, 0);
			num += 4;
			this._header = new int[15];
			Buffer.BlockCopy(this._fileBytes, num, this._header, 0, this._header.Length * 4);
			num += this._header.Length * 4;
			this._structList = new int[this._header[6] * 9];
			Buffer.BlockCopy(this._fileBytes, num, this._structList, 0, this._structList.Length * 4);
			num += this._structList.Length * 4;
			int num2 = this._header[0] + this._header[7] + this._header[10] + this._header[13];
			this._structIntValueListPosition = this._header[0];
			this._intValueListPosition = this._structIntValueListPosition + this._header[7];
			this._nameLengthPosition = this._intValueListPosition + this._header[10];
			this._intPool = new int[num2];
			Buffer.BlockCopy(this._fileBytes, num, this._intPool, 0, num2 * 4);
			num += num2 * 4;
			int num3 = this._header[1] + this._header[8] + this._header[11];
			this._structFloatValueListPosition = this._header[1];
			this._floatValueListPosition = this._structFloatValueListPosition + this._header[8];
			this._floatPool = new float[num3];
			Buffer.BlockCopy(this._fileBytes, num, this._floatPool, 0, num3 * 4);
			num += num3 * 4;
			int num4 = this._header[2] + this._header[9] + this._header[12] + this._header[14];
			if (num + num4 > this._fileBytes.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return false;
			}
			this._bytePool = this._fileBytes;
			this._bytePoolPosition = num;
			this._structByteValueListPosition = this._bytePoolPosition + this._header[2];
			this._byteValueListPosition = this._structByteValueListPosition + this._header[9];
			this._namePosition = this._byteValueListPosition + this._header[12];
			return this._PostfixPreparse();
		}

		// Token: 0x060002BF RID: 703 RVA: 0x000170C8 File Offset: 0x000152C8
		private bool _PostfixPreparse()
		{
			if (this._fileBytes == null || this._intPool == null || this._header == null)
			{
				Debug.LogError("(BinaryReader) null.");
				this._isError = true;
				return false;
			}
			if (this._nameLengthPosition + this._header[13] > this._intPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return false;
			}
			int num = this._header[13];
			this._nameList = new string[num];
			int num2 = this._nameLengthPosition;
			int num3 = this._namePosition;
			for (int i = 0; i < num; i++)
			{
				int num4 = this._intPool[num2];
				if (num3 + num4 > this._fileBytes.Length)
				{
					Debug.LogError("(BinaryReader) Overflow.");
					this._isError = true;
					return false;
				}
				this._nameList[i] = Encoding.UTF8.GetString(this._fileBytes, num3, num4);
				num2++;
				num3 += num4 + 1;
			}
			return true;
		}

		// Token: 0x060002C0 RID: 704 RVA: 0x000171C4 File Offset: 0x000153C4
		public void Rewind()
		{
			if (this._isError)
			{
				return;
			}
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.None;
			this._currentHeaderIntValueIndex = 0;
			this._currentHeaderFloatValueIndex = 0;
			this._currentHeaderByteValueIndex = 0;
			this._currentStructListIndex = 0;
			this._currentStructIndex = 0;
			this._currentStructFourCC = 0;
			this._currentStructFlags = 0;
			this._currentStructLength = 0;
			this._currentStructIntValueLength = 0;
			this._currentStructFloatValueLength = 0;
			this._currentStructByteValueLength = 0;
			this._currentStructIntValueIndex = 0;
			this._currentStructFloatValueIndex = 0;
			this._currentStructByteValueIndex = 0;
			this._currentIntPoolPosition = 0;
			this._currentIntPoolRemain = 0;
			this._currentFloatPoolPosition = 0;
			this._currentFloatPoolRemain = 0;
			this._currentBytePoolPosition = 0;
			this._currentBytePoolRemain = 0;
		}

		// Token: 0x060002C1 RID: 705 RVA: 0x00017270 File Offset: 0x00015470
		public bool BeginHeader()
		{
			if (this._isError)
			{
				return false;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.None)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			this._currentHeaderIntValueIndex = 0;
			this._currentHeaderFloatValueIndex = 0;
			this._currentHeaderByteValueIndex = 0;
			this._currentIntPoolPosition = 0;
			this._currentFloatPoolPosition = 0;
			this._currentBytePoolPosition = 0;
			this._currentIntPoolRemain = this._header[3];
			this._currentFloatPoolRemain = this._header[4];
			this._currentBytePoolRemain = this._header[5];
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.Header;
			return true;
		}

		// Token: 0x060002C2 RID: 706 RVA: 0x00017300 File Offset: 0x00015500
		public int ReadHeaderInt()
		{
			if (this._isError)
			{
				return 0;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Header)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				this._isError = true;
				return 0;
			}
			if (this._currentHeaderIntValueIndex >= this._header[0])
			{
				return 0;
			}
			int currentHeaderIntValueIndex = this._currentHeaderIntValueIndex;
			if (this._intPool == null || currentHeaderIntValueIndex >= this._intPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0;
			}
			int result = this._intPool[currentHeaderIntValueIndex];
			this._currentHeaderIntValueIndex++;
			return result;
		}

		// Token: 0x060002C3 RID: 707 RVA: 0x0001739C File Offset: 0x0001559C
		public float ReadHeaderFloat()
		{
			if (this._isError)
			{
				return 0f;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Header)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				this._isError = true;
				return 0f;
			}
			if (this._currentHeaderFloatValueIndex >= this._header[1])
			{
				return 0f;
			}
			int currentHeaderFloatValueIndex = this._currentHeaderFloatValueIndex;
			if (this._floatPool == null || currentHeaderFloatValueIndex >= this._floatPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0f;
			}
			float result = this._floatPool[currentHeaderFloatValueIndex];
			this._currentHeaderFloatValueIndex++;
			return result;
		}

		// Token: 0x060002C4 RID: 708 RVA: 0x00017448 File Offset: 0x00015648
		public byte ReadHeaderByte()
		{
			if (this._isError)
			{
				return 0;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Header)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				this._isError = true;
				return 0;
			}
			if (this._currentHeaderByteValueIndex >= this._header[2])
			{
				return 0;
			}
			int num = this._bytePoolPosition + this._currentHeaderByteValueIndex;
			if (this._bytePool == null || num >= this._bytePool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0;
			}
			byte result = this._bytePool[num];
			this._currentHeaderByteValueIndex++;
			return result;
		}

		// Token: 0x060002C5 RID: 709 RVA: 0x000174E8 File Offset: 0x000156E8
		public bool EndHeader()
		{
			if (this._isError)
			{
				return false;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Header)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			this._currentHeaderIntValueIndex = 0;
			this._currentHeaderFloatValueIndex = 0;
			this._currentHeaderByteValueIndex = 0;
			this._currentIntPoolPosition = 0;
			this._currentFloatPoolPosition = 0;
			this._currentBytePoolPosition = 0;
			this._currentIntPoolRemain = 0;
			this._currentFloatPoolRemain = 0;
			this._currentBytePoolRemain = 0;
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.None;
			return true;
		}

		// Token: 0x060002C6 RID: 710 RVA: 0x00017564 File Offset: 0x00015764
		public bool BeginStructList()
		{
			if (this._isError)
			{
				return false;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.None)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			if (this._structList == null || this._currentStructListIndex + 1 > this._structList.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				return false;
			}
			this._currentStructIndex = 0;
			this._currentStructFourCC = this._structList[this._currentStructListIndex * 9];
			this._currentStructFlags = this._structList[this._currentStructListIndex * 9 + 1];
			this._currentStructLength = this._structList[this._currentStructListIndex * 9 + 2];
			this._currentStructIntValueLength = this._structList[this._currentStructListIndex * 9 + 3];
			this._currentStructFloatValueLength = this._structList[this._currentStructListIndex * 9 + 4];
			this._currentStructByteValueLength = this._structList[this._currentStructListIndex * 9 + 5];
			this._currentIntPoolPosition = this._structList[this._currentStructListIndex * 9 + 6];
			this._currentFloatPoolPosition = this._structList[this._currentStructListIndex * 9 + 7];
			this._currentBytePoolPosition = this._structList[this._currentStructListIndex * 9 + 8];
			this._currentStructIntValueIndex = 0;
			this._currentStructFloatValueIndex = 0;
			this._currentStructByteValueIndex = 0;
			this._currentIntPoolRemain = 0;
			this._currentFloatPoolRemain = 0;
			this._currentBytePoolRemain = 0;
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.StructList;
			return true;
		}

		// Token: 0x060002C7 RID: 711 RVA: 0x000176D0 File Offset: 0x000158D0
		public bool BeginStruct()
		{
			if (this._isError)
			{
				return false;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.StructList)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			if (this._currentStructIndex >= this._currentStructLength)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				return false;
			}
			if (this._currentStructIntValueIndex + 3 > this._currentStructIntValueLength)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return false;
			}
			if (this._intPool == null || this._structIntValueListPosition + 3 > this._intPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return false;
			}
			this._currentIntPoolRemain = this._intPool[this._structIntValueListPosition];
			this._currentFloatPoolRemain = this._intPool[this._structIntValueListPosition + 1];
			this._currentBytePoolRemain = this._intPool[this._structIntValueListPosition + 2];
			this._currentStructIntValueIndex = 3;
			this._structIntValueListPosition += 3;
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.Struct;
			return true;
		}

		// Token: 0x060002C8 RID: 712 RVA: 0x000177D4 File Offset: 0x000159D4
		public int ReadStructInt()
		{
			if (this._isError)
			{
				return 0;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Struct)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return 0;
			}
			if (this._currentStructIntValueIndex >= this._currentStructIntValueLength)
			{
				return 0;
			}
			if (this._intPool == null || this._structIntValueListPosition >= this._intPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0;
			}
			int result = this._intPool[this._structIntValueListPosition];
			this._currentStructIntValueIndex++;
			this._structIntValueListPosition++;
			return result;
		}

		// Token: 0x060002C9 RID: 713 RVA: 0x00017878 File Offset: 0x00015A78
		public float ReadStructFloat()
		{
			if (this._isError)
			{
				return 0f;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Struct)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return 0f;
			}
			if (this._currentStructFloatValueIndex >= this._currentStructFloatValueLength)
			{
				return 0f;
			}
			if (this._floatPool == null || this._structFloatValueListPosition >= this._floatPool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0f;
			}
			float result = this._floatPool[this._structFloatValueListPosition];
			this._currentStructFloatValueIndex++;
			this._structFloatValueListPosition++;
			return result;
		}

		// Token: 0x060002CA RID: 714 RVA: 0x0001792C File Offset: 0x00015B2C
		public Vector2 ReadStructVector2()
		{
			Vector2 zero = Vector2.zero;
			zero.x = this.ReadStructFloat();
			zero.y = this.ReadStructFloat();
			return zero;
		}

		// Token: 0x060002CB RID: 715 RVA: 0x0001795C File Offset: 0x00015B5C
		public Vector3 ReadStructVector3()
		{
			Vector3 zero = Vector3.zero;
			zero.x = this.ReadStructFloat();
			zero.y = this.ReadStructFloat();
			zero.z = this.ReadStructFloat();
			return zero;
		}

		// Token: 0x060002CC RID: 716 RVA: 0x00017998 File Offset: 0x00015B98
		public byte ReadStructByte()
		{
			if (this._isError)
			{
				return 0;
			}
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Struct)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return 0;
			}
			if (this._currentStructByteValueIndex >= this._currentStructByteValueLength)
			{
				return 0;
			}
			if (this._bytePool == null || this._structByteValueListPosition >= this._bytePool.Length)
			{
				Debug.LogError("(BinaryReader) Overflow.");
				this._isError = true;
				return 0;
			}
			byte result = this._bytePool[this._structByteValueListPosition];
			this._currentStructByteValueIndex++;
			this._structByteValueListPosition++;
			return result;
		}

		// Token: 0x060002CD RID: 717 RVA: 0x00017A3C File Offset: 0x00015C3C
		public bool EndStruct()
		{
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.Struct)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			if (this._currentStructIntValueIndex < this._currentStructIntValueLength)
			{
				this._structIntValueListPosition += this._currentStructIntValueLength - this._currentStructIntValueIndex;
			}
			if (this._currentStructFloatValueIndex < this._currentStructFloatValueLength)
			{
				this._structFloatValueListPosition += this._currentStructFloatValueLength - this._currentStructFloatValueIndex;
			}
			if (this._currentStructByteValueIndex < this._currentStructByteValueLength)
			{
				this._structByteValueListPosition += this._currentStructByteValueLength - this._currentStructByteValueIndex;
			}
			this._currentIntPoolPosition += this._currentIntPoolRemain;
			this._currentFloatPoolPosition += this._currentFloatPoolRemain;
			this._currentBytePoolPosition += this._currentBytePoolRemain;
			this._currentStructIndex++;
			this._currentStructIntValueIndex = 0;
			this._currentStructFloatValueIndex = 0;
			this._currentStructByteValueIndex = 0;
			this._currentIntPoolRemain = 0;
			this._currentFloatPoolRemain = 0;
			this._currentBytePoolRemain = 0;
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.StructList;
			return true;
		}

		// Token: 0x060002CE RID: 718 RVA: 0x00017B5C File Offset: 0x00015D5C
		public bool EndStructList()
		{
			if (this._readMode != MMD4MecanimCommon.BinaryReader.ReadMode.StructList)
			{
				Debug.LogError("(BinaryReader) invalid flow.");
				return false;
			}
			if (this._currentStructIndex < this._currentStructLength)
			{
				this._structIntValueListPosition += this._currentStructIntValueLength * (this._currentStructLength - this._currentStructIndex);
				this._structFloatValueListPosition += this._currentStructFloatValueLength * (this._currentStructLength - this._currentStructIndex);
				this._structByteValueListPosition += this._currentStructByteValueLength * (this._currentStructLength - this._currentStructIndex);
			}
			this._currentStructListIndex++;
			this._currentStructIndex = 0;
			this._currentStructFourCC = 0;
			this._currentStructFlags = 0;
			this._currentStructLength = 0;
			this._currentStructIntValueLength = 0;
			this._currentStructFloatValueLength = 0;
			this._currentStructByteValueLength = 0;
			this._currentIntPoolPosition = 0;
			this._currentFloatPoolPosition = 0;
			this._currentBytePoolPosition = 0;
			this._currentStructIntValueIndex = 0;
			this._currentStructFloatValueIndex = 0;
			this._currentStructByteValueIndex = 0;
			this._currentIntPoolRemain = 0;
			this._currentFloatPoolRemain = 0;
			this._currentBytePoolRemain = 0;
			this._readMode = MMD4MecanimCommon.BinaryReader.ReadMode.None;
			return true;
		}

		// Token: 0x060002CF RID: 719 RVA: 0x00017C7C File Offset: 0x00015E7C
		public int ReadInt()
		{
			if (this._intPool == null || this._currentIntPoolRemain == 0)
			{
				return 0;
			}
			int result = this._intPool[this._intValueListPosition + this._currentIntPoolPosition];
			this._currentIntPoolPosition++;
			this._currentIntPoolRemain--;
			return result;
		}

		// Token: 0x060002D0 RID: 720 RVA: 0x00017CD4 File Offset: 0x00015ED4
		public float ReadFloat()
		{
			if (this._floatPool == null || this._currentFloatPoolRemain == 0)
			{
				return 0f;
			}
			float result = this._floatPool[this._floatValueListPosition + this._currentFloatPoolPosition];
			this._currentFloatPoolPosition++;
			this._currentFloatPoolRemain--;
			return result;
		}

		// Token: 0x060002D1 RID: 721 RVA: 0x00017D30 File Offset: 0x00015F30
		public Color ReadColor()
		{
			float r = this.ReadFloat();
			float g = this.ReadFloat();
			float b = this.ReadFloat();
			float a = this.ReadFloat();
			return new Color(r, g, b, a);
		}

		// Token: 0x060002D2 RID: 722 RVA: 0x00017D64 File Offset: 0x00015F64
		public Color ReadColorRGB()
		{
			float r = this.ReadFloat();
			float g = this.ReadFloat();
			float b = this.ReadFloat();
			return new Color(r, g, b, 1f);
		}

		// Token: 0x060002D3 RID: 723 RVA: 0x00017D94 File Offset: 0x00015F94
		public Vector3 ReadVector3()
		{
			float x = this.ReadFloat();
			float y = this.ReadFloat();
			float z = this.ReadFloat();
			return new Vector3(x, y, z);
		}

		// Token: 0x060002D4 RID: 724 RVA: 0x00017DC0 File Offset: 0x00015FC0
		public Quaternion ReadQuaternion()
		{
			float x = this.ReadFloat();
			float y = this.ReadFloat();
			float z = this.ReadFloat();
			float w = this.ReadFloat();
			return new Quaternion(x, y, z, w);
		}

		// Token: 0x060002D5 RID: 725 RVA: 0x00017DF4 File Offset: 0x00015FF4
		public byte ReadByte()
		{
			if (this._fileBytes == null || this._currentBytePoolRemain == 0)
			{
				return 0;
			}
			byte result = this._fileBytes[this._byteValueListPosition + this._currentBytePoolPosition];
			this._currentBytePoolPosition++;
			this._currentBytePoolRemain--;
			return result;
		}

		// Token: 0x060002D6 RID: 726 RVA: 0x00017E4B File Offset: 0x0001604B
		public string GetName(int index)
		{
			if (this._nameList != null && index < this._nameList.Length)
			{
				return this._nameList[index];
			}
			return string.Empty;
		}

		// Token: 0x0400031D RID: 797
		private byte[] _fileBytes;

		// Token: 0x0400031E RID: 798
		private int _fourCC;

		// Token: 0x0400031F RID: 799
		private int _structIntValueListPosition;

		// Token: 0x04000320 RID: 800
		private int _structFloatValueListPosition;

		// Token: 0x04000321 RID: 801
		private int _structByteValueListPosition;

		// Token: 0x04000322 RID: 802
		private int _intValueListPosition;

		// Token: 0x04000323 RID: 803
		private int _floatValueListPosition;

		// Token: 0x04000324 RID: 804
		private int _byteValueListPosition;

		// Token: 0x04000325 RID: 805
		private int _nameLengthPosition;

		// Token: 0x04000326 RID: 806
		private int _namePosition;

		// Token: 0x04000327 RID: 807
		private int[] _header;

		// Token: 0x04000328 RID: 808
		private int[] _structList;

		// Token: 0x04000329 RID: 809
		private int[] _intPool;

		// Token: 0x0400032A RID: 810
		private float[] _floatPool;

		// Token: 0x0400032B RID: 811
		private byte[] _bytePool;

		// Token: 0x0400032C RID: 812
		private string[] _nameList;

		// Token: 0x0400032D RID: 813
		private int _bytePoolPosition;

		// Token: 0x0400032E RID: 814
		private MMD4MecanimCommon.BinaryReader.ReadMode _readMode;

		// Token: 0x0400032F RID: 815
		private bool _isError;

		// Token: 0x04000330 RID: 816
		private int _currentHeaderIntValueIndex;

		// Token: 0x04000331 RID: 817
		private int _currentHeaderFloatValueIndex;

		// Token: 0x04000332 RID: 818
		private int _currentHeaderByteValueIndex;

		// Token: 0x04000333 RID: 819
		private int _currentStructListIndex;

		// Token: 0x04000334 RID: 820
		private int _currentStructIndex;

		// Token: 0x04000335 RID: 821
		private int _currentStructFourCC;

		// Token: 0x04000336 RID: 822
		private int _currentStructFlags;

		// Token: 0x04000337 RID: 823
		private int _currentStructLength;

		// Token: 0x04000338 RID: 824
		private int _currentStructIntValueLength;

		// Token: 0x04000339 RID: 825
		private int _currentStructFloatValueLength;

		// Token: 0x0400033A RID: 826
		private int _currentStructByteValueLength;

		// Token: 0x0400033B RID: 827
		private int _currentStructIntValueIndex;

		// Token: 0x0400033C RID: 828
		private int _currentStructFloatValueIndex;

		// Token: 0x0400033D RID: 829
		private int _currentStructByteValueIndex;

		// Token: 0x0400033E RID: 830
		private int _currentIntPoolPosition;

		// Token: 0x0400033F RID: 831
		private int _currentIntPoolRemain;

		// Token: 0x04000340 RID: 832
		private int _currentFloatPoolPosition;

		// Token: 0x04000341 RID: 833
		private int _currentFloatPoolRemain;

		// Token: 0x04000342 RID: 834
		private int _currentBytePoolPosition;

		// Token: 0x04000343 RID: 835
		private int _currentBytePoolRemain;

		// Token: 0x02000062 RID: 98
		private enum Header
		{
			// Token: 0x04000345 RID: 837
			HeaderIntValueListLength,
			// Token: 0x04000346 RID: 838
			HeaderFloatValueListLength,
			// Token: 0x04000347 RID: 839
			HeaderByteValueListLength,
			// Token: 0x04000348 RID: 840
			IntValueLengthInHeader,
			// Token: 0x04000349 RID: 841
			FloatValueLengthInHeader,
			// Token: 0x0400034A RID: 842
			ByteValueLengthInHeader,
			// Token: 0x0400034B RID: 843
			StructListLength,
			// Token: 0x0400034C RID: 844
			StructIntValueListLength,
			// Token: 0x0400034D RID: 845
			StructFloatValueListLength,
			// Token: 0x0400034E RID: 846
			StructByteValueListLength,
			// Token: 0x0400034F RID: 847
			IntValueListLength,
			// Token: 0x04000350 RID: 848
			FloatValueListLength,
			// Token: 0x04000351 RID: 849
			ByteValueListLength,
			// Token: 0x04000352 RID: 850
			NameLengthListLength,
			// Token: 0x04000353 RID: 851
			NameLength,
			// Token: 0x04000354 RID: 852
			Max
		}

		// Token: 0x02000063 RID: 99
		private enum ReadMode
		{
			// Token: 0x04000356 RID: 854
			None,
			// Token: 0x04000357 RID: 855
			Header,
			// Token: 0x04000358 RID: 856
			StructList,
			// Token: 0x04000359 RID: 857
			Struct
		}
	}

	// Token: 0x02000064 RID: 100
	public enum TextureFileSign
	{
		// Token: 0x0400035B RID: 859
		None,
		// Token: 0x0400035C RID: 860
		Bmp,
		// Token: 0x0400035D RID: 861
		BmpWithAlpha,
		// Token: 0x0400035E RID: 862
		Png,
		// Token: 0x0400035F RID: 863
		PngWithAlpha,
		// Token: 0x04000360 RID: 864
		Jpeg,
		// Token: 0x04000361 RID: 865
		Targa,
		// Token: 0x04000362 RID: 866
		TargaWithAlpha
	}

	// Token: 0x02000065 RID: 101
	public class CloneMeshWork
	{
		// Token: 0x04000363 RID: 867
		public Mesh mesh;

		// Token: 0x04000364 RID: 868
		public string name;

		// Token: 0x04000365 RID: 869
		public Vector3[] vertices;

		// Token: 0x04000366 RID: 870
		public Vector3[] normals;

		// Token: 0x04000367 RID: 871
		public Vector4[] tangents;

		// Token: 0x04000368 RID: 872
		public Color32[] colors32;

		// Token: 0x04000369 RID: 873
		public BoneWeight[] boneWeights;

		// Token: 0x0400036A RID: 874
		public Bounds bounds;

		// Token: 0x0400036B RID: 875
		public HideFlags hideFlags;

		// Token: 0x0400036C RID: 876
		public Vector2[] uv1;

		// Token: 0x0400036D RID: 877
		public Vector2[] uv2;

		// Token: 0x0400036E RID: 878
		public Vector2[] uv;

		// Token: 0x0400036F RID: 879
		public Matrix4x4[] bindposes;

		// Token: 0x04000370 RID: 880
		public int[] triangles;
	}

	// Token: 0x02000066 RID: 102
	public struct FastVector3
	{
		// Token: 0x060002D8 RID: 728 RVA: 0x00017E74 File Offset: 0x00016074
		public FastVector3(Vector3 value, bool isZero)
		{
			this.value = value;
			this._isZero = ((!isZero) ? 0 : 1);
		}

		// Token: 0x060002D9 RID: 729 RVA: 0x00017E90 File Offset: 0x00016090
		public FastVector3(Vector3 value)
		{
			this.value = value;
			this._isZero = -1;
		}

		// Token: 0x060002DA RID: 730 RVA: 0x00017EA0 File Offset: 0x000160A0
		public FastVector3(ref Vector3 value)
		{
			this.value = value;
			this._isZero = -1;
		}

		// Token: 0x17000062 RID: 98
		// (get) Token: 0x060002DB RID: 731 RVA: 0x00017EB5 File Offset: 0x000160B5
		public bool isZero
		{
			get
			{
				if (this._isZero == -1)
				{
					this._isZero = ((!(this.value == Vector3.zero)) ? 0 : 1);
				}
				return this._isZero != 0;
			}
		}

		// Token: 0x060002DC RID: 732 RVA: 0x00017EF1 File Offset: 0x000160F1
		public override bool Equals(object obj)
		{
			return obj is MMD4MecanimCommon.FastVector3 && this.Equals((MMD4MecanimCommon.FastVector3)obj);
		}

		// Token: 0x060002DD RID: 733 RVA: 0x00017F0C File Offset: 0x0001610C
		public bool Equals(MMD4MecanimCommon.FastVector3 rhs)
		{
			return this.value == rhs.value;
		}

		// Token: 0x060002DE RID: 734 RVA: 0x00017F20 File Offset: 0x00016120
		public override int GetHashCode()
		{
			return this.value.GetHashCode();
		}

		// Token: 0x17000063 RID: 99
		// (get) Token: 0x060002DF RID: 735 RVA: 0x00017F33 File Offset: 0x00016133
		public static MMD4MecanimCommon.FastVector3 zero
		{
			get
			{
				return new MMD4MecanimCommon.FastVector3(Vector3.zero, true);
			}
		}

		// Token: 0x060002E0 RID: 736 RVA: 0x00017F40 File Offset: 0x00016140
		public static implicit operator Vector3(MMD4MecanimCommon.FastVector3 v)
		{
			return v.value;
		}

		// Token: 0x060002E1 RID: 737 RVA: 0x00017F49 File Offset: 0x00016149
		public static implicit operator MMD4MecanimCommon.FastVector3(Vector3 v)
		{
			return new MMD4MecanimCommon.FastVector3(ref v);
		}

		// Token: 0x060002E2 RID: 738 RVA: 0x00017F52 File Offset: 0x00016152
		public static bool operator ==(MMD4MecanimCommon.FastVector3 lhs, Vector3 rhs)
		{
			return lhs.value == rhs;
		}

		// Token: 0x060002E3 RID: 739 RVA: 0x00017F61 File Offset: 0x00016161
		public static bool operator !=(MMD4MecanimCommon.FastVector3 lhs, Vector3 rhs)
		{
			return lhs.value != rhs;
		}

		// Token: 0x060002E4 RID: 740 RVA: 0x00017F70 File Offset: 0x00016170
		public static MMD4MecanimCommon.FastVector3 operator +(MMD4MecanimCommon.FastVector3 lhs, Vector3 rhs)
		{
			if (lhs.isZero)
			{
				return new MMD4MecanimCommon.FastVector3(rhs);
			}
			return new MMD4MecanimCommon.FastVector3(lhs.value + rhs);
		}

		// Token: 0x060002E5 RID: 741 RVA: 0x00017F97 File Offset: 0x00016197
		public static MMD4MecanimCommon.FastVector3 operator +(Vector3 lhs, MMD4MecanimCommon.FastVector3 rhs)
		{
			if (rhs.isZero)
			{
				return new MMD4MecanimCommon.FastVector3(lhs);
			}
			return new MMD4MecanimCommon.FastVector3(lhs + rhs.value);
		}

		// Token: 0x060002E6 RID: 742 RVA: 0x00017FC0 File Offset: 0x000161C0
		public static MMD4MecanimCommon.FastVector3 operator +(MMD4MecanimCommon.FastVector3 lhs, MMD4MecanimCommon.FastVector3 rhs)
		{
			if (lhs.isZero && rhs.isZero)
			{
				return lhs;
			}
			if (lhs.isZero)
			{
				return rhs;
			}
			if (rhs.isZero)
			{
				return lhs;
			}
			return new MMD4MecanimCommon.FastVector3(lhs.value + rhs.value);
		}

		// Token: 0x04000371 RID: 881
		public Vector3 value;

		// Token: 0x04000372 RID: 882
		private int _isZero;
	}

	// Token: 0x02000067 RID: 103
	public struct FastQuaternion
	{
		// Token: 0x060002E7 RID: 743 RVA: 0x0001801B File Offset: 0x0001621B
		public FastQuaternion(Quaternion value, bool isIdentity)
		{
			this.value = value;
			this._isIdentity = ((!isIdentity) ? 0 : 1);
		}

		// Token: 0x060002E8 RID: 744 RVA: 0x00018037 File Offset: 0x00016237
		public FastQuaternion(Quaternion value)
		{
			this.value = value;
			this._isIdentity = -1;
		}

		// Token: 0x060002E9 RID: 745 RVA: 0x00018047 File Offset: 0x00016247
		public FastQuaternion(ref Quaternion value)
		{
			this.value = value;
			this._isIdentity = -1;
		}

		// Token: 0x17000064 RID: 100
		// (get) Token: 0x060002EA RID: 746 RVA: 0x0001805C File Offset: 0x0001625C
		public bool isIdentity
		{
			get
			{
				if (this._isIdentity == -1)
				{
					this._isIdentity = ((!(this.value == Quaternion.identity)) ? 0 : 1);
				}
				return this._isIdentity != 0;
			}
		}

		// Token: 0x060002EB RID: 747 RVA: 0x00018098 File Offset: 0x00016298
		public override bool Equals(object obj)
		{
			return obj is MMD4MecanimCommon.FastQuaternion && this.Equals((MMD4MecanimCommon.FastQuaternion)obj);
		}

		// Token: 0x060002EC RID: 748 RVA: 0x000180B3 File Offset: 0x000162B3
		public bool Equals(MMD4MecanimCommon.FastQuaternion rhs)
		{
			return this.value == rhs.value;
		}

		// Token: 0x060002ED RID: 749 RVA: 0x000180C7 File Offset: 0x000162C7
		public override int GetHashCode()
		{
			return this.value.GetHashCode();
		}

		// Token: 0x17000065 RID: 101
		// (get) Token: 0x060002EE RID: 750 RVA: 0x000180DA File Offset: 0x000162DA
		public static MMD4MecanimCommon.FastQuaternion identity
		{
			get
			{
				return new MMD4MecanimCommon.FastQuaternion(Quaternion.identity, true);
			}
		}

		// Token: 0x060002EF RID: 751 RVA: 0x000180E7 File Offset: 0x000162E7
		public static implicit operator Quaternion(MMD4MecanimCommon.FastQuaternion q)
		{
			return q.value;
		}

		// Token: 0x060002F0 RID: 752 RVA: 0x000180F0 File Offset: 0x000162F0
		public static implicit operator MMD4MecanimCommon.FastQuaternion(Quaternion q)
		{
			return new MMD4MecanimCommon.FastQuaternion(q);
		}

		// Token: 0x060002F1 RID: 753 RVA: 0x000180F8 File Offset: 0x000162F8
		public static bool operator ==(MMD4MecanimCommon.FastQuaternion lhs, Quaternion rhs)
		{
			return lhs.value == rhs;
		}

		// Token: 0x060002F2 RID: 754 RVA: 0x00018107 File Offset: 0x00016307
		public static bool operator !=(MMD4MecanimCommon.FastQuaternion lhs, Quaternion rhs)
		{
			return lhs.value != rhs;
		}

		// Token: 0x060002F3 RID: 755 RVA: 0x00018116 File Offset: 0x00016316
		public static MMD4MecanimCommon.FastQuaternion operator *(MMD4MecanimCommon.FastQuaternion lhs, Quaternion rhs)
		{
			if (lhs.isIdentity)
			{
				return new MMD4MecanimCommon.FastQuaternion(rhs);
			}
			return new MMD4MecanimCommon.FastQuaternion(lhs.value * rhs);
		}

		// Token: 0x060002F4 RID: 756 RVA: 0x0001813D File Offset: 0x0001633D
		public static MMD4MecanimCommon.FastQuaternion operator *(Quaternion lhs, MMD4MecanimCommon.FastQuaternion rhs)
		{
			if (rhs.isIdentity)
			{
				return new MMD4MecanimCommon.FastQuaternion(lhs);
			}
			return new MMD4MecanimCommon.FastQuaternion(lhs * rhs.value);
		}

		// Token: 0x060002F5 RID: 757 RVA: 0x00018164 File Offset: 0x00016364
		public static MMD4MecanimCommon.FastQuaternion operator *(MMD4MecanimCommon.FastQuaternion lhs, MMD4MecanimCommon.FastQuaternion rhs)
		{
			if (lhs.isIdentity && rhs.isIdentity)
			{
				return lhs;
			}
			if (lhs.isIdentity)
			{
				return rhs;
			}
			if (rhs.isIdentity)
			{
				return lhs;
			}
			return new MMD4MecanimCommon.FastQuaternion(lhs.value * rhs.value, false);
		}

		// Token: 0x04000373 RID: 883
		public Quaternion value;

		// Token: 0x04000374 RID: 884
		private int _isIdentity;
	}
}
